package com.web.stat;

import com.StatService;
import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.dubbo.config.spring.context.annotation.DubboComponentScan;
import com.web.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/stat")
@DubboComponentScan
public class StatController extends BaseController {

    @Reference
    private StatService statService;

    @RequestMapping("/toCharts")
    //转发到指定的统计图 通过chartsType进行区分
    public String toCharts(String chartsType){
        return "stat/stat-" + chartsType;
    }

    @RequestMapping("/factoryCharts")
    public @ResponseBody List factoryData(){
        return statService.getFactoryData(companyId);
    }

    @RequestMapping("/sellCharts")
    public @ResponseBody List sellCharts(){
        return statService.getSellData(companyId);
    }

    @RequestMapping("/onlineCharts")
    public @ResponseBody List onlineCharts(){
        return statService.getOnlineData(companyId);
    }

}
